<template>
	<view>
		<uv-cell-group v-if="urlparm.all==0" title="全部">
			<uv-cell title="不限车型" is-link @click="toneed"></uv-cell>
		</uv-cell-group>
		<uv-cell-group v-for="cartype in types" :key="cartype.year" :title="cartype.year">
			<uv-cell v-for="car in cartype.child" :key="car.id" :title="`${car.year}款 ${car.outputval} ${car.cartype}`"
				:label="`新车价:${car.guideprice}万`" isLink @click="topublish(car)"></uv-cell>
		</uv-cell-group>
	</view>
</template>

<script>
	import { getCarTypeInfoById } from '@/utils/http.js'
	export default {
		data() {
			return {
				types: [],
				urlparm: {}
			}
		},
		onLoad(option) {
			const item = JSON.parse(decodeURIComponent(option.items))
			this.urlparm = item
			this.getcartype()
		},
		methods: {
			topublish(cell) {
				const item = this.urlparm
				item.car = cell
				uni.$emit('car_brand', item)
				uni.navigateBack({ delta: 3 })

			},
			toneed(){
				const item = this.urlparm
				item.car = {cartype:'不限车型'}
				uni.$emit('car_brand', item)
				uni.navigateBack({ delta: 3 })
			},
			getcartype() {
				const parm = {
					brandid: this.urlparm.brand.id,
					subbrandid: this.urlparm.series.id
				}
				getCarTypeInfoById(parm).then(res => {
					this.types = res.data
				})
			}
		}
	}
</script>

<style>
page{
	background: #fff !important;
}
.uv-cell-group__title{
	background: #f3f4f6;
	padding: 28upx 30upx !important;

}
.uv-cell-group__title__text{
	color: #909193 !important;
	font-size: 30upx !important;
}
.uv-cell__title-text{
	font-size: 28upx !important;
}
</style>